﻿@{
    ViewBag.Title = "MaterialInspectionIndex";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@section Head
{
    @Html.Css("dp")
    @Html.Js("datepicker")
    <script type="text/javascript">
        var mainheight = document.documentElement.clientHeight;
        var mainWidth = document.documentElement.clientWidth - 10;
        $(document).ready(function () {
            $("#instockdt").datepicker({ picker: "<img class='picker' align='middle' src='Images/s.gif' alt=''/>" });
            var otherpm = $("#title").height() + $("#findDiv").height(); // 290;
            var gh = mainheight - otherpm - 80;
            var pyy = $("#outstockyy :selected").text();
            var option = {
                height: gh,
                width: mainWidth,
                url: '@Url.Action("GetMaterialInspection")',
                colModel: [
                    { display: '序号', name: 'ID', width: 60, sortable: false, align: 'left', hide: false, iskey: true },
                    { display: 'ID', width: 120, sortable: false, hide: true, align: 'left' },
                    { display: '入库时间', width: 120, sortable: false, hide: true, align: 'left' },
			        { display: '仓库编号', width: 50, sortable: false, hide: true, align: 'left' },
                    { display: '班组', width: 50, sortable: false, hide: true, align: 'left' },
                    { display: '食材品名', width: 80, sortable: false, hide: true, align: 'left' },
                    { display: '食材品名', width: 200, sortable: false, hide: false, align: 'left' },
                    { display: '数量', width: 50, sortable: false, hide: false, align: 'left' },
                    { display: '单价', width: 50, sortable: false, hide: false, align: 'left' },
                    { display: '金额', width: 50, sortable: false, hide: false, align: 'left' },
                    { display: '供应商', width: 50, sortable: false, hide: true, align: 'left' },
                    { display: '记录时间', width: 50, sortable: false, hide: true, align: 'left' },
                    { display: '操作员', width: 50, sortable: false, hide: true, align: 'left' },
                    { display: '批号', width: 50, sortable: false, hide: true, align: 'left' }
				],
                singleselected: true,
                sortname: "Sequence",
                sortorder: "asc",
                title: false,
                usepager: true,
                page: 1,
                rp: 20,
                rpOptions: [10, 15, 20],
                showcheckbox: true,
                rowbinddata: true,
                query: $("#instockdt").val() + "," + $("#instockgroup :selected").val()
            };
            $("#instockinspection").flexigrid(option);

            $("#btnQueryList").click(function () {
                option.query = $("#instockdt").val() + "," + $("#instockgroup :selected").val();
                option.newp = 0;
                $("#instockinspection").flexOptions(option).flexReload();
            });
            $("#btnExport").click(function () {
                var dt = $("#instockdt").val();
                var gid = $("#instockgroup :selected").val();
                var strulr = "ExprotMaterialInspection?dt=" + dt + "&gid=" + gid;
                var subwin = window.open(strulr, "", "menubar=no,toolbar=no,status=no,resizable=no,scrollbars=yes");
                subwin.moveTo(0, 0);
                subwin.resizeTo(window.screen.availWidth, window.screen.availHeight);
                return false;
            });
        });
    </script>
}
<div id="container">
    <div id="mainContent">
        <div id="title" class="title">
            食堂原材料验收单</div>
        <div id="findDiv">
            <table>
                <tr>
                    <td style="text-align: right; width: 80px;">
                        日期：
                    </td>
                    <td>@Html.TextBox("instockdt", DateTime.Now.Date.ToString(),
                                   new { @style = "width:158px; height:22px; font-size:13px;" })
                    </td>
                    <td style="text-align: right; width: 80px;">
                        食堂：
                    </td>
                    <td>@Html.DropDownList("instockgroup",
                                        ViewData["Warehouse_ID"] as IEnumerable<SelectListItem>,
                                   new { @style = "width:158px; height:22px; font-size:13px;" })
                    </td>
                    <td>
                        <a id="btnQueryList" class="button" href="javascript:void(0);"><span>查 询</span></a>
                        <a id="btnExport" class="button" href="javascript:void(0);"><span>导 出</span></a>
                    </td>
                </tr>
            </table>
        </div>
        <table id="instockinspection" style="display: none;">
        </table>
    </div>
</div>
